package org.shilong.Utility;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date;

import org.shilong.Model.PartyModel;

public class PartyComparotr implements Comparator<PartyModel> {

	@Override
	public int compare(PartyModel bean1, PartyModel bean2) {
		int rlt = 0;

		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh：mm：ss");

		Date d1 =null;
		Date d2 =null;

		try {

			d1 = sdf.parse( bean1.getPa_start_time() );
			d2 = sdf.parse( bean2.getPa_start_time() );

			if( d1.after( d2 )){

				rlt = -1;

			}else if ( d1.before(d2) ){

				rlt = 1;

			}
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return rlt;
	}

}
